package com.dacool.http;

import java.util.HashMap;

import org.json.JSONException;
import org.json.JSONObject;

import com.dacool.config.Config;

public class AddAddressRequest extends BaseRequest {

	/**
	 * memberId:”61234”,”address”:”望京桥月亮家园32楼2106”,”region”:”北京市 朝阳区”,
	 * deliveryMan：”送货人张三”,mobile:”13632567896”, remark:”备注节日送货”
	 */

	private String memberId;
	private String address;
	// private int region;
	private String deliveryMan;
	private String mobile;
	private String remark;
	private String area;
	private int shipRegionId;
	
	public AddAddressRequest setShipRegionId(int shipRegionId) {
		this.shipRegionId = shipRegionId;
		return this;
	}

	@Override
	protected String url() {
		// TODO Auto-generated method stub
		return "addAddress.jsn";
	}

	@Override
	protected void generateParams(HashMap<String, Object> map) {
		// TODO Auto-generated method stub
		// map.put("memberId", memberId);
		JSONObject object = new JSONObject();
		try {
			object.put("name", deliveryMan);
			object.put("addr", address);
			object.put("mobile", mobile);
			object.put("area", area);
			object.put("shipRegionId", shipRegionId);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		map.put("address", object.toString());
	}

	public AddAddressRequest setMemberId(String memberId) {
		this.memberId = memberId;
		return this;
	}

	public AddAddressRequest setAddress(String address) {
		this.address = address;
		return this;
	}

	// public AddAddressRequest setRegion(int region) {
	// this.region = region;
	// return this;
	// }

	public AddAddressRequest setArea(String area) {
		this.area = area;
		return this;
	}

	public AddAddressRequest setDeliveryMan(String deliveryMan) {
		this.deliveryMan = deliveryMan;
		return this;
	}

	public AddAddressRequest setMobile(String mobile) {
		this.mobile = mobile;
		return this;
	}

	public AddAddressRequest setRemark(String remark) {
		this.remark = remark;
		return this;
	}

}
